<template>
  <div class="box">
    <van-sticky class="nav">
      <!-- 顶部导航 -->
      <van-nav-bar class="topNaV" @click-left="onClickLeft">
        <template #title>
          <p class="title">意见反馈</p>
        </template>
        <template #left>
          <van-icon name="arrow-left" color="#666666" />
          <p class="left">返回</p>
        </template>
      </van-nav-bar>
    </van-sticky>
    <div>
      <p>意见</p>
      <van-field
        v-model="message"
        rows="2"
        autosize
        label="留言"
        type="textarea"
        maxlength="50"
        placeholder="请输入留言"
        show-word-limit
      />

      <p>联系方式</p>
      <van-cell-group>
        <van-field v-model="value" label="手机号码" placeholder="请输入手机号" />
      </van-cell-group>
      <div style="text-align:center">
        <button @click="up">提交</button>
      </div>
    </div>
  </div>
</template>
<script setup>
import { ref } from 'vue'
import { useStore } from 'vuex'
import { useRouter } from 'vue-router'
import { submitActionUser } from '@/api/index'
const message = ref('')
const value = ref('')
const store = useStore()
const router = useRouter()
const up = () => {
  submitActionUser({
    content: message.value,
    phone: value.value,
    name: store.state.username,
    openId: store.state.openId
  })
  alert('提交成功')
}

const onClickLeft = () => {
  router.back()
}
</script>
<script>
export default {
  name: 'submitAction'
}
</script>

<style scoped lang="scss">
.box {
  .nav {
    .topNav {
      .left {
        font-size: 31.2px;
        color: #666666;
        letter-spacing: 0;
        font-weight: 400;
      }

      .title {
        font-size: 36px;
        color: #333333;
        letter-spacing: 0;
        font-weight: 500;
      }
    }
  }
}
</style>
